﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace IronWinter
{
    public class Terrain
    {
        protected AnimatedSprite aniSprite;
        protected Rectangle m_hitbox;
        public Point position;
        public int size;

        public Terrain(int xpos, int ypos, int width, int length, Texture2D tex)
        {
            aniSprite = new AnimatedSprite(tex == null ? Game1.genericTexture : tex, width, length, width, length, 1);
            aniSprite.tint = Color.White;
            m_hitbox = new Rectangle(xpos, ypos, width, length);
            position = new Point(xpos, ypos);
        }


        public Rectangle hitBox
        {
            get { return m_hitbox; }
        }

        public Vector2 Center
        {
            get { return new Vector2(X + Map.cellSize * size / 2, Y + Map.cellSize * size / 2); }
        }

        public int Y
        {
            get { return position.Y; }
            set { position.Y = value; }
        }

        public int X
        {
            get { return position.X; }
            set { position.X = value; }
        }

        virtual public void Draw(SpriteBatch sb)
        {
            aniSprite.Draw(sb, m_hitbox, aniSprite.tint);
        }

    }

    class ImpassableTerrain : Terrain
    {
        public ImpassableTerrain(int x, int y, int width, int length, Texture2D tex)
            : base(x, y, width, length, tex)
        { }
    }
}
